# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Pablo Correa Gomez <ablocorrea@hotmail.com>
pkgname=gnome-control-center
pkgver=42.3
pkgrel=0
pkgdesc="GNOME control center"
url="https://gitlab.gnome.org/GNOME/gnome-control-center"
# s390x and riscv64 blocked by polkit
arch="all !s390x !riscv64"
license="GPL-2.0-or-later"
depends="
	accountsservice
	dbus:org.freedesktop.Secrets
	colord
	cups-pk-helper
	openrc-settingsd
"
makedepends="
	accountsservice-dev
	cairo-dev
	colord-dev
	colord-gtk-dev
	cups-dev
	docbook-xml
	docbook-xsl
	gcr-dev
	glib-dev
	gnome-bluetooth-dev
	gnome-desktop-dev
	gnome-online-accounts-dev
	gnome-settings-daemon-dev
	gsound-dev
	ibus-dev
	itstool
	krb5-dev
	libadwaita-dev
	libgtop-dev
	libgudev-dev
	libnma-dev
	libpwquality-dev
	libsecret-dev
	libwacom-dev
	libxml2-utils
	libxslt
	meson
	modemmanager-dev
	networkmanager-dev
	polkit-dev
	pulseaudio-dev
	samba-dev
	udisks2-dev
	upower-dev
	"
options="!check" # needs unpackaged py-dbusmock
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-lang $pkgname-doc $pkgname-bash-completion"
source="https://download.gnome.org/sources/gnome-control-center/${pkgver%.*}/gnome-control-center-$pkgver.tar.xz
	README.alpine
	fix-user-back-panel.patch
	removable-media-fit-narrow.patch
	0001-common-Wrap-CcPermissionInfobar-labels-to-fit-in-nar.patch
	0002-display-Wrap-Night-Light-GtkInfoBar-label-to-fit-in-.patch
	0003-printers-Wrap-job-dialog-GtkInfoBar-label-to-fit-in-.patch
	"

build() {
	abuild-meson \
		-Dibus=true \
		. output

	# Bad dep file -> blows up when compiling with multiple build jobs otherwise
	ninja -C output panels/network/cc-network-resources.c
	ninja -C output panels/network/cc-network-resources.h

	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	mkdir -p "$pkgdir"/usr/lib/pkgconfig
	mv "$pkgdir"/usr/share/pkgconfig/* "$pkgdir"/usr/lib/pkgconfig
	rmdir "$pkgdir"/usr/share/pkgconfig

	install -Dm0644 "$srcdir"/README.alpine -t "$pkgdir"/usr/share/doc/"$pkgname"
}

sha512sums="
eb82f65b580637fa057196daed836b3ea24a223b9932a2063b2879357f8a62626a6939835dc165a6d3c5706d16b99192301d4de021e68faaabb8d2ecc2a317a3  gnome-control-center-42.3.tar.xz
350aa443149c71851ad4de0976c7fc5cb626ba0c57a8d41e6ef80da1c65ed84a4dfa2483ae92630a3b611c4bfa9360ded82b55e8cd0e3907294c025e4f6b1671  README.alpine
cc2748b5cfdce6cf4a6eae0a0b723bff49397278f9acda470a5b13dc6f9560ac73e222fc380a8aff02a715a99326204132e7229a16e1ff73927e88e395bdfab0  fix-user-back-panel.patch
507a3d3bdf79cce908a17cd6779bad0d787b6d707fe7c96f92d2310b0c20a772f6c50b951a4c7d7edd50fbbd89c39ac7c38aebe490192825b37d4283bfbd4010  removable-media-fit-narrow.patch
b0ba1e5b3431029d98b87d461f9f29bc142cc6460dd6df902f1773f174beb911495d2ece80737425cd8325129fb8579bdf6bc5f1fd06548ed159153fc000a286  0001-common-Wrap-CcPermissionInfobar-labels-to-fit-in-nar.patch
6e8ba6a1422a0103b7bc4c6e87df6fe64e9454e3960d116e088794e78d096a4e887d0c562809482b1ab414399b1863495075076a85825baf4357d7fdad5e1b55  0002-display-Wrap-Night-Light-GtkInfoBar-label-to-fit-in-.patch
de0e7d946e12cc331879b8f211eaced968bde5308ddf3ef97ea946808a2bdb0f0e8c87ac37d21c14ab83292c116697686a29e2b4106fd37782bd10d6bcf0d1cf  0003-printers-Wrap-job-dialog-GtkInfoBar-label-to-fit-in-.patch
"
